<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Parsing Pipelines</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Parsing Pipelines' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../intern.html">Inter Modules</a></li><li><a href="index.html">pipeline</a></li><li><a href="index.html#2">Chapter 2: Pipelines</a></li><li><b>Parsing Pipelines</b></li></ul></div>
<p class="purpose">To parse pipelines from text files.</p>

<ul class="toc"><li><a href="2-pp.html#SP1">&#167;1. How pipelines are stored</a></li><li><a href="2-pp.html#SP5">&#167;5. Parsing</a></li><li><a href="2-pp.html#SP10">&#167;10. Stages</a></li><li><a href="2-pp.html#SP11">&#167;11. Starting a variables dictionary</a></li><li><a href="2-pp.html#SP12">&#167;12. Back to text</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. How pipelines are stored.</b>An <a href="2-pp.html#SP1" class="internal">inter_pipeline</a> is a linked list of //pipeline_step//s, together with
some associated storage used when it runs: this is for storing variables and
pointers to trees being worked on.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">inter_pipeline</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">linked_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">steps</span><span class="plain-syntax">; </span><span class="comment-syntax"> of </span><span class="extract"><span class="extract-syntax">pipeline_step</span></span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">dictionary</span><span class="plain-syntax"> *</span><span class="identifier-syntax">variables</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">erroneous</span><span class="plain-syntax">; </span><span class="comment-syntax"> a syntax error occurred when parsing this</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">pipeline_ephemera</span><span class="plain-syntax"> </span><span class="identifier-syntax">ephemera</span><span class="plain-syntax">; </span><span class="comment-syntax"> temporary storage when running</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">linked_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">search_list</span><span class="plain-syntax">; </span><span class="comment-syntax"> used when parsing only</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">pathname</span><span class="plain-syntax"> *</span><span class="identifier-syntax">local</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">run_depth</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">inter_pipeline</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">inter_pipeline</span><span class="plain-syntax"> *</span><span class="function-syntax">ParsingPipelines::new_pipeline</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">ParsingPipelines::new_pipeline</span></span>:<br/><a href="2-pp.html#SP5">&#167;5</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">dictionary</span><span class="plain-syntax"> *</span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="identifier-syntax">linked_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">L</span><span class="plain-syntax">, </span><span class="identifier-syntax">pathname</span><span class="plain-syntax"> *</span><span class="identifier-syntax">local</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_pipeline</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CREATE</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_pipeline</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">variables</span><span class="plain-syntax"> = </span><span class="identifier-syntax">D</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">steps</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NEW_LINKED_LIST</span><span class="plain-syntax">(</span><span class="reserved-syntax">pipeline_step</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">erroneous</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">search_list</span><span class="plain-syntax"> = </span><span class="identifier-syntax">L</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">local</span><span class="plain-syntax"> = </span><span class="identifier-syntax">local</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">run_depth</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="2-rp.html#SP1" class="function-link"><span class="function-syntax">RunningPipelines::clean_pipeline</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">S</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<ul class="endnotetexts"><li>The structure inter_pipeline is accessed in 2/rp, 2/pe, 2/ns, 2/rmss, 3/ps, 3/rccs, 3/css, 4/lbks, 4/sws, 4/dics, 4/mius, 4/rvs, 5/msms, 6/erms, 6/erls, 6/eros and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b>A <a href="2-pp.html#SP2" class="internal">pipeline_step</a> is really only a choice of <a href="2-pp.html#SP3" class="internal">pipeline_stage</a>, but comes
along with a wide variety of options and parameter settings, so that it looks
much more complicated than it actually is.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">pipeline_step</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">inter_pipeline</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pipeline</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">pipeline_stage</span><span class="plain-syntax"> *</span><span class="identifier-syntax">step_stage</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">step_argument</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">code_generator</span><span class="plain-syntax"> *</span><span class="identifier-syntax">generator_argument</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">take_generator_argument_from_VM</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">package_URL_argument</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">tree_argument</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">pipeline_step_ephemera</span><span class="plain-syntax"> </span><span class="identifier-syntax">ephemera</span><span class="plain-syntax">; </span><span class="comment-syntax"> temporary storage when running</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">pipeline_step</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">pipeline_step</span><span class="plain-syntax"> *</span><span class="function-syntax">ParsingPipelines::new_step</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">ParsingPipelines::new_step</span></span>:<br/><a href="2-pp.html#SP8">&#167;8</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_pipeline</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pipeline</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">pipeline_step</span><span class="plain-syntax"> *</span><span class="identifier-syntax">step</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CREATE</span><span class="plain-syntax">(</span><span class="reserved-syntax">pipeline_step</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">pipeline</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pipeline</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_stage</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_argument</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">package_URL_argument</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">tree_argument</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">generator_argument</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">take_generator_argument_from_VM</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="2-rp.html#SP2" class="function-link"><span class="function-syntax">RunningPipelines::clean_step</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">step</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">step</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<ul class="endnotetexts"><li>The structure pipeline_step is accessed in 2/rp, 2/pe, 2/ns, 2/rmss, 3/ps, 3/rccs, 3/css, 4/lbks, 4/sws, 4/dics, 4/mius, 4/rvs, 5/msms, 6/erms, 6/erls, 6/eros and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b>And a <a href="2-pp.html#SP3" class="internal">pipeline_stage</a> is simply a choice of what to do. For example,
<span class="extract"><span class="extract-syntax">eliminate-redundant-labels</span></span> is a pipeline stage. This would need to be
combined with details of what tree to apply to in order to become a step.
</p>

<pre class="definitions code-font"><span class="definition-keyword">enum</span> <span class="constant-syntax">NO_STAGE_ARG</span><span class="plain-syntax"> </span><span class="identifier-syntax">from</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">GENERAL_STAGE_ARG</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">FILE_STAGE_ARG</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">TEXT_OUT_STAGE_ARG</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">OPTIONAL_TEXT_OUT_STAGE_ARG</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">EXT_FILE_STAGE_ARG</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">EXT_TEXT_OUT_STAGE_ARG</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">KIT_STAGE_ARG</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">pipeline_stage</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">stage_name</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> (*</span><span class="identifier-syntax">execute</span><span class="plain-syntax">)(</span><span class="reserved-syntax">void</span><span class="plain-syntax"> *);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">stage_arg</span><span class="plain-syntax">; </span><span class="comment-syntax"> one of the </span><span class="extract"><span class="extract-syntax">*_ARG</span></span><span class="comment-syntax"> values above</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">takes_tree</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">pipeline_stage</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">pipeline_stage</span><span class="plain-syntax"> *</span><span class="function-syntax">ParsingPipelines::new_stage</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">ParsingPipelines::new_stage</span></span>:<br/>New Stage - <a href="2-ns.html#SP1">&#167;1</a><br/>Read, Move, Stop Stages - <a href="2-rmss.html#SP1">&#167;1</a><br/>Parsing Stages - <a href="3-ps.html#SP1">&#167;1</a><br/>Resolve Conditional Compilation Stage - <a href="3-rccs.html#SP1">&#167;1</a><br/>Compile Splats Stage - <a href="3-css.html#SP1">&#167;1</a><br/>Load Binary Kits Stage - <a href="4-lbks.html#SP3">&#167;3</a><br/>Shorten Wiring Stage - <a href="4-sws.html#SP1">&#167;1</a><br/>Detect Indirect Calls Stage - <a href="4-dics.html#SP1">&#167;1</a><br/>Make Identifiers Unique Stage - <a href="4-mius.html#SP1">&#167;1</a><br/>Reconcile Verbs Stage - <a href="4-rvs.html#SP1">&#167;1</a><br/>Make Synoptic Module Stage - <a href="5-msms.html#SP1">&#167;1</a><br/>Eliminate Redundant Matter Stage - <a href="6-erms.html#SP1">&#167;1</a><br/>Eliminate Redundant Labels Stage - <a href="6-erls.html#SP1">&#167;1</a><br/>Eliminate Redundant Operations Stage - <a href="6-eros.html#SP1">&#167;1</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">name</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> (*</span><span class="identifier-syntax">X</span><span class="plain-syntax">)(</span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">pipeline_step</span><span class="plain-syntax"> *), </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">arg</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">tr</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">pipeline_stage</span><span class="plain-syntax"> *</span><span class="identifier-syntax">stage</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CREATE</span><span class="plain-syntax">(</span><span class="reserved-syntax">pipeline_stage</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">stage</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">stage_name</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::duplicate</span><span class="plain-syntax">(</span><span class="identifier-syntax">name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">#</span><span class="identifier-syntax">pragma</span><span class="plain-syntax"> </span><span class="identifier-syntax">clang</span><span class="plain-syntax"> </span><span class="identifier-syntax">diagnostic</span><span class="plain-syntax"> </span><span class="identifier-syntax">push</span>
<span class="plain-syntax">#</span><span class="identifier-syntax">pragma</span><span class="plain-syntax"> </span><span class="identifier-syntax">clang</span><span class="plain-syntax"> </span><span class="identifier-syntax">diagnostic</span><span class="plain-syntax"> </span><span class="identifier-syntax">ignored</span><span class="plain-syntax"> </span><span class="string-syntax">"-Wcast-function-type-strict"</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">stage</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">execute</span><span class="plain-syntax"> = (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> (*)(</span><span class="reserved-syntax">void</span><span class="plain-syntax"> *)) </span><span class="identifier-syntax">X</span><span class="plain-syntax">;</span>
<span class="plain-syntax">#</span><span class="identifier-syntax">pragma</span><span class="plain-syntax"> </span><span class="identifier-syntax">clang</span><span class="plain-syntax"> </span><span class="identifier-syntax">diagnostic</span><span class="plain-syntax"> </span><span class="identifier-syntax">pop</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">stage</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">stage_arg</span><span class="plain-syntax"> = </span><span class="identifier-syntax">arg</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">stage</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">takes_tree</span><span class="plain-syntax"> = </span><span class="identifier-syntax">tr</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">stage</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<ul class="endnotetexts"><li>The structure pipeline_stage is accessed in 2/rp and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. </b>Lumping some of those argument types together:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">ParsingPipelines::will_read_a_file</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">ParsingPipelines::will_read_a_file</span></span>:<br/>Running Pipelines - <a href="2-rp.html#SP3_1_2">&#167;3.1.2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">pipeline_step</span><span class="plain-syntax"> *</span><span class="identifier-syntax">step</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_stage</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">stage_arg</span><span class="plain-syntax"> == </span><span class="constant-syntax">FILE_STAGE_ARG</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_stage</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">stage_arg</span><span class="plain-syntax"> == </span><span class="constant-syntax">EXT_FILE_STAGE_ARG</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">ParsingPipelines::will_write_a_file</span><button class="popup" onclick="togglePopup('usagePopup5')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup5">Usage of <span class="code-font"><span class="function-syntax">ParsingPipelines::will_write_a_file</span></span>:<br/>Running Pipelines - <a href="2-rp.html#SP3_1_2">&#167;3.1.2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">pipeline_step</span><span class="plain-syntax"> *</span><span class="identifier-syntax">step</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_stage</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">stage_arg</span><span class="plain-syntax"> == </span><span class="constant-syntax">TEXT_OUT_STAGE_ARG</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_stage</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">stage_arg</span><span class="plain-syntax"> == </span><span class="constant-syntax">OPTIONAL_TEXT_OUT_STAGE_ARG</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_stage</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">stage_arg</span><span class="plain-syntax"> == </span><span class="constant-syntax">EXT_TEXT_OUT_STAGE_ARG</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. Parsing.</b>All pipelines originate as textual descriptions, either from a text file or
supplied on the command line. Here, we turn such a description &mdash; in effect
a program for a very simple programming language &mdash; into an <a href="2-pp.html#SP1" class="internal">inter_pipeline</a>.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">inter_pipeline</span><span class="plain-syntax"> *</span><span class="function-syntax">ParsingPipelines::from_file</span><span class="plain-syntax">(</span><span class="identifier-syntax">filename</span><span class="plain-syntax"> *</span><span class="identifier-syntax">F</span><span class="plain-syntax">, </span><span class="identifier-syntax">dictionary</span><span class="plain-syntax"> *</span><span class="identifier-syntax">D</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">linked_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">search_list</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_pipeline</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax"> = </span><a href="2-pp.html#SP1" class="function-link"><span class="function-syntax">ParsingPipelines::new_pipeline</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="identifier-syntax">search_list</span><span class="plain-syntax">, </span><span class="identifier-syntax">Filenames::up</span><span class="plain-syntax">(</span><span class="identifier-syntax">F</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TextFiles::read</span><span class="plain-syntax">(</span><span class="identifier-syntax">F</span><span class="plain-syntax">, </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">, </span><span class="string-syntax">"can't open inter pipeline file"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">, </span><a href="2-pp.html#SP5" class="function-link"><span class="function-syntax">ParsingPipelines::scan_line</span></a><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, (</span><span class="reserved-syntax">void</span><span class="plain-syntax"> *) </span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">erroneous</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">S</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">ParsingPipelines::scan_line</span><button class="popup" onclick="togglePopup('usagePopup6')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup6">Usage of <span class="code-font"><span class="function-syntax">ParsingPipelines::scan_line</span></span>:<br/><a href="2-pp.html#SP7">&#167;7</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">line</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_file_position</span><span class="plain-syntax"> *</span><span class="identifier-syntax">tfp</span><span class="plain-syntax">, </span><span class="reserved-syntax">void</span><span class="plain-syntax"> *</span><span class="identifier-syntax">X</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_pipeline</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax"> = (</span><span class="reserved-syntax">inter_pipeline</span><span class="plain-syntax"> *) </span><span class="identifier-syntax">X</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="2-pp.html#SP6" class="function-link"><span class="function-syntax">ParsingPipelines::parse_line</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">line</span><span class="plain-syntax">, </span><span class="identifier-syntax">tfp</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">inter_pipeline</span><span class="plain-syntax"> *</span><span class="function-syntax">ParsingPipelines::from_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">instructions</span><span class="plain-syntax">, </span><span class="identifier-syntax">dictionary</span><span class="plain-syntax"> *</span><span class="identifier-syntax">D</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_pipeline</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax"> = </span><a href="2-pp.html#SP1" class="function-link"><span class="function-syntax">ParsingPipelines::new_pipeline</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-pp.html#SP6" class="function-link"><span class="function-syntax">ParsingPipelines::parse_line</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">instructions</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">erroneous</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">S</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. </b>Either way, then, a sequence of 1 or more textual lines of description is
passed to the following. It breaks down the line into 1 or more instructions,
divided by commas.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">ParsingPipelines::parse_line</span><button class="popup" onclick="togglePopup('usagePopup7')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup7">Usage of <span class="code-font"><span class="function-syntax">ParsingPipelines::parse_line</span></span>:<br/><a href="2-pp.html#SP5">&#167;5</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_pipeline</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pipeline</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">instructions</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_file_position</span><span class="plain-syntax"> *</span><span class="identifier-syntax">tfp</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">T</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_THROUGH_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">instructions</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Characters::is_babel_whitespace</span><span class="plain-syntax">(</span><span class="identifier-syntax">Str::get</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">)))</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">PUT_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">T</span><span class="plain-syntax">, </span><span class="character-syntax">' '</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">PUT_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">T</span><span class="plain-syntax">, </span><span class="identifier-syntax">Str::get</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">match_results</span><span class="plain-syntax"> </span><span class="identifier-syntax">mr</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Regexp::create_mr</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr</span><span class="plain-syntax">, </span><span class="identifier-syntax">T</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">" *(%c+?) *,+ *(%c*?) *"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><a href="2-pp.html#SP7" class="function-link"><span class="function-syntax">ParsingPipelines::parse_instruction</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pipeline</span><span class="plain-syntax">, </span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[0], </span><span class="identifier-syntax">tfp</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Str::copy</span><span class="plain-syntax">(</span><span class="identifier-syntax">T</span><span class="plain-syntax">, </span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[1]);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr</span><span class="plain-syntax">, </span><span class="identifier-syntax">T</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">" *(%c+?) *"</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><a href="2-pp.html#SP7" class="function-link"><span class="function-syntax">ParsingPipelines::parse_instruction</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pipeline</span><span class="plain-syntax">, </span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[0], </span><span class="identifier-syntax">tfp</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Regexp::dispose_of</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">T</span><span class="plain-syntax">)</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP7" class="paragraph-anchor"></a><b>&#167;7. </b>Instructions are mostly steps, but:
</p>

<ul class="items"><li>(a) A line beginning with an <span class="extract"><span class="extract-syntax">!</span></span> is a comment,
</li><li>(b) <span class="extract"><span class="extract-syntax">run pipeline X</span></span> means to incorporate pipeline <span class="extract"><span class="extract-syntax">X</span></span> here.
</li></ul>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">ParsingPipelines::parse_instruction</span><button class="popup" onclick="togglePopup('usagePopup8')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup8">Usage of <span class="code-font"><span class="function-syntax">ParsingPipelines::parse_instruction</span></span>:<br/><a href="2-pp.html#SP6">&#167;6</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_pipeline</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pipeline</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">T</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_file_position</span><span class="plain-syntax"> *</span><span class="identifier-syntax">tfp</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">match_results</span><span class="plain-syntax"> </span><span class="identifier-syntax">mr</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Regexp::create_mr</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr</span><span class="plain-syntax">, </span><span class="identifier-syntax">T</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"!%c*"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        ;</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr</span><span class="plain-syntax">, </span><span class="identifier-syntax">T</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"run pipeline (%c*)"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">filename</span><span class="plain-syntax"> *</span><span class="identifier-syntax">F</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">SUPERVISOR_MODULE</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">F</span><span class="plain-syntax"> = </span><span class="identifier-syntax">InterSkill::filename_of_pipeline</span><span class="plain-syntax">(</span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[0], </span><span class="identifier-syntax">pipeline</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">search_list</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        #</span><span class="identifier-syntax">endif</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">F</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">leafname</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::new</span><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">leafname</span><span class="plain-syntax">, </span><span class="string-syntax">"%S.interpipeline"</span><span class="plain-syntax">, </span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[0]);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">F</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Filenames::in</span><span class="plain-syntax">(</span><span class="identifier-syntax">pipeline</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">local</span><span class="plain-syntax">, </span><span class="identifier-syntax">leafname</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">F</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><a href="2-pe.html#SP1" class="function-link"><span class="function-syntax">PipelineErrors::syntax_with</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">tfp</span><span class="plain-syntax">, </span><span class="identifier-syntax">T</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="string-syntax">"unable to find the pipeline '%S'"</span><span class="plain-syntax">, </span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[0]);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">pipeline</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">erroneous</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pipeline</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">run_depth</span><span class="plain-syntax">++ &gt; </span><span class="constant-syntax">100</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><a href="2-pe.html#SP1" class="function-link"><span class="function-syntax">PipelineErrors::syntax_with</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">tfp</span><span class="plain-syntax">, </span><span class="identifier-syntax">T</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                    </span><span class="string-syntax">"pipeline seems to have become circular: '%S'"</span><span class="plain-syntax">, </span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[0]);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">pipeline</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">erroneous</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">TextFiles::read</span><span class="plain-syntax">(</span><span class="identifier-syntax">F</span><span class="plain-syntax">, </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">, </span><span class="string-syntax">"can't open inter pipeline file"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">, </span><a href="2-pp.html#SP5" class="function-link"><span class="function-syntax">ParsingPipelines::scan_line</span></a><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, (</span><span class="reserved-syntax">void</span><span class="plain-syntax"> *) </span><span class="identifier-syntax">pipeline</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">pipeline</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">run_depth</span><span class="plain-syntax">--;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">pipeline_step</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ST</span><span class="plain-syntax"> = </span><a href="2-pp.html#SP8" class="function-link"><span class="function-syntax">ParsingPipelines::parse_step</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pipeline</span><span class="plain-syntax">, </span><span class="identifier-syntax">T</span><span class="plain-syntax">, </span><span class="identifier-syntax">tfp</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ST</span><span class="plain-syntax">) </span><span class="identifier-syntax">ADD_TO_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">ST</span><span class="plain-syntax">, </span><span class="reserved-syntax">pipeline_step</span><span class="plain-syntax">, </span><span class="identifier-syntax">pipeline</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">steps</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">pipeline</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">erroneous</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Regexp::dispose_of</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP8" class="paragraph-anchor"></a><b>&#167;8. </b>Finally, an individual textual description <span class="extract"><span class="extract-syntax">S</span></span> of a step is turned into a
<a href="2-pp.html#SP2" class="internal">pipeline_step</a>.
</p>

<p class="commentary">For documentation on the syntax here, see <a href="../inter/M-pas.html" class="internal">Pipelines and Stages (in inter)</a>.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">pipeline_step</span><span class="plain-syntax"> *</span><span class="function-syntax">ParsingPipelines::parse_step</span><button class="popup" onclick="togglePopup('usagePopup9')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup9">Usage of <span class="code-font"><span class="function-syntax">ParsingPipelines::parse_step</span></span>:<br/><a href="2-pp.html#SP7">&#167;7</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_pipeline</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pipeline</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_file_position</span><span class="plain-syntax"> *</span><span class="identifier-syntax">tfp</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">dictionary</span><span class="plain-syntax"> *</span><span class="identifier-syntax">D</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pipeline</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">variables</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">pipeline_step</span><span class="plain-syntax"> *</span><span class="identifier-syntax">step</span><span class="plain-syntax"> = </span><a href="2-pp.html#SP2" class="function-link"><span class="function-syntax">ParsingPipelines::new_step</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pipeline</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">syntax</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::duplicate</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">match_results</span><span class="plain-syntax"> </span><span class="identifier-syntax">mr</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Regexp::create_mr</span><span class="plain-syntax">();</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">allow_unknown</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"optionally-%c+"</span><span class="plain-syntax">)) </span><span class="identifier-syntax">allow_unknown</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">left_arrow_used</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">,      </span><span class="identifier-syntax">U</span><span class="string-syntax">"(%c+?) *&lt;- *(%c*)"</span><span class="plain-syntax">))       </span><span class="named-paragraph-container code-font"><a href="2-pp.html#SP8_1" class="named-paragraph-link"><span class="named-paragraph">Left arrow notation</span><span class="named-paragraph-number">8.1</span></a></span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"(%c+?) (%C+) *-&gt; *(%c*)"</span><span class="plain-syntax">)) </span><span class="named-paragraph-container code-font"><a href="2-pp.html#SP8_2" class="named-paragraph-link"><span class="named-paragraph">Right arrow notation with generator</span><span class="named-paragraph-number">8.2</span></a></span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"(%c+?) *-&gt; *(%c*)"</span><span class="plain-syntax">))       </span><span class="named-paragraph-container code-font"><a href="2-pp.html#SP8_3" class="named-paragraph-link"><span class="named-paragraph">Right arrow notation without generator</span><span class="named-paragraph-number">8.3</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">,      </span><span class="identifier-syntax">U</span><span class="string-syntax">"(%C+?) (%d)"</span><span class="plain-syntax">))             </span><span class="named-paragraph-container code-font"><a href="2-pp.html#SP8_4" class="named-paragraph-link"><span class="named-paragraph">Tree number as argument</span><span class="named-paragraph-number">8.4</span></a></span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"(%C+?) (%d):(%c*)"</span><span class="plain-syntax">))       </span><span class="named-paragraph-container code-font"><a href="2-pp.html#SP8_5" class="named-paragraph-link"><span class="named-paragraph">Tree number and package as arguments</span><span class="named-paragraph-number">8.5</span></a></span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"(%C+?) (%c+)"</span><span class="plain-syntax">))            </span><span class="named-paragraph-container code-font"><a href="2-pp.html#SP8_6" class="named-paragraph-link"><span class="named-paragraph">Package as argument</span><span class="named-paragraph-number">8.6</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_stage</span><span class="plain-syntax"> = </span><a href="2-pp.html#SP10" class="function-link"><span class="function-syntax">ParsingPipelines::parse_stage</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-pp.html#SP8_7" class="named-paragraph-link"><span class="named-paragraph">Make consistency checks</span><span class="named-paragraph-number">8.7</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">Regexp::dispose_of</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">step</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP8_1" class="paragraph-anchor"></a><b>&#167;8.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Left arrow notation</span><span class="named-paragraph-number">8.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[1]) &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_argument</span><span class="plain-syntax"> = </span><a href="2-pp.html#SP9" class="function-link"><span class="function-syntax">ParsingPipelines::text_arg</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[1], </span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="identifier-syntax">tfp</span><span class="plain-syntax">, </span><span class="identifier-syntax">syntax</span><span class="plain-syntax">, </span><span class="identifier-syntax">allow_unknown</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_argument</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><a href="2-pe.html#SP1" class="function-link"><span class="function-syntax">PipelineErrors::syntax</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">tfp</span><span class="plain-syntax">, </span><span class="identifier-syntax">syntax</span><span class="plain-syntax">, </span><span class="string-syntax">"no source to right of arrow"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Str::copy</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[0]);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">left_arrow_used</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-pp.html#SP8">&#167;8</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP8_2" class="paragraph-anchor"></a><b>&#167;8.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Right arrow notation with generator</span><span class="named-paragraph-number">8.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">code_generator</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cgt</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Generators::find</span><span class="plain-syntax">(</span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[1]);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cgt</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><a href="2-pe.html#SP1" class="function-link"><span class="function-syntax">PipelineErrors::syntax_with</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">tfp</span><span class="plain-syntax">, </span><span class="identifier-syntax">syntax</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"no such code generation format as '%S'"</span><span class="plain-syntax">, </span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[1]);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">generator_argument</span><span class="plain-syntax"> = </span><span class="identifier-syntax">cgt</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_argument</span><span class="plain-syntax"> = </span><a href="2-pp.html#SP9" class="function-link"><span class="function-syntax">ParsingPipelines::text_arg</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[2], </span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="identifier-syntax">tfp</span><span class="plain-syntax">, </span><span class="identifier-syntax">syntax</span><span class="plain-syntax">, </span><span class="identifier-syntax">allow_unknown</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_argument</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Str::copy</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[0]);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-pp.html#SP8">&#167;8</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP8_3" class="paragraph-anchor"></a><b>&#167;8.3. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Right arrow notation without generator</span><span class="named-paragraph-number">8.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">generator_argument</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">take_generator_argument_from_VM</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_argument</span><span class="plain-syntax"> = </span><a href="2-pp.html#SP9" class="function-link"><span class="function-syntax">ParsingPipelines::text_arg</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[1], </span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="identifier-syntax">tfp</span><span class="plain-syntax">, </span><span class="identifier-syntax">syntax</span><span class="plain-syntax">, </span><span class="identifier-syntax">allow_unknown</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_argument</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Str::copy</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[0]);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-pp.html#SP8">&#167;8</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP8_4" class="paragraph-anchor"></a><b>&#167;8.4. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Tree number as argument</span><span class="named-paragraph-number">8.4</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">tree_argument</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::atoi</span><span class="plain-syntax">(</span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[1], </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Str::copy</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[0]);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-pp.html#SP8">&#167;8</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP8_5" class="paragraph-anchor"></a><b>&#167;8.5. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Tree number and package as arguments</span><span class="named-paragraph-number">8.5</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">tree_argument</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::atoi</span><span class="plain-syntax">(</span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[1], </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[2]) &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">package_URL_argument</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">            </span><a href="2-pp.html#SP9" class="function-link"><span class="function-syntax">ParsingPipelines::text_arg</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[2], </span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="identifier-syntax">tfp</span><span class="plain-syntax">, </span><span class="identifier-syntax">syntax</span><span class="plain-syntax">, </span><span class="identifier-syntax">allow_unknown</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">package_URL_argument</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Str::copy</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[0]);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-pp.html#SP8">&#167;8</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP8_6" class="paragraph-anchor"></a><b>&#167;8.6. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Package as argument</span><span class="named-paragraph-number">8.6</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">package_URL_argument</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">        </span><a href="2-pp.html#SP9" class="function-link"><span class="function-syntax">ParsingPipelines::text_arg</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[1], </span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="identifier-syntax">tfp</span><span class="plain-syntax">, </span><span class="identifier-syntax">syntax</span><span class="plain-syntax">, </span><span class="identifier-syntax">allow_unknown</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">package_URL_argument</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Str::copy</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[0]);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-pp.html#SP8">&#167;8</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP8_7" class="paragraph-anchor"></a><b>&#167;8.7. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Make consistency checks</span><span class="named-paragraph-number">8.7</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_stage</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><a href="2-pe.html#SP1" class="function-link"><span class="function-syntax">PipelineErrors::syntax_with</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">tfp</span><span class="plain-syntax">, </span><span class="identifier-syntax">syntax</span><span class="plain-syntax">, </span><span class="string-syntax">"no such stage as '%S'"</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_stage</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">takes_tree</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">left_arrow_used</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><a href="2-pe.html#SP1" class="function-link"><span class="function-syntax">PipelineErrors::syntax</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">tfp</span><span class="plain-syntax">, </span><span class="identifier-syntax">syntax</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="string-syntax">"this stage should take a left arrow and a source"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">left_arrow_used</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><a href="2-pe.html#SP1" class="function-link"><span class="function-syntax">PipelineErrors::syntax</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">tfp</span><span class="plain-syntax">, </span><span class="identifier-syntax">syntax</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="string-syntax">"this stage should not take a left arrow and a source"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-pp.html#SP8">&#167;8</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP9" class="paragraph-anchor"></a><b>&#167;9. </b>A textual argument beginning with an asterisk means "expand to the value of
this variable", which is required to exist unless <span class="extract"><span class="extract-syntax">allow_unknown</span></span> is set.
If it is, then an empty text results as the argument.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="function-syntax">ParsingPipelines::text_arg</span><button class="popup" onclick="togglePopup('usagePopup10')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup10">Usage of <span class="code-font"><span class="function-syntax">ParsingPipelines::text_arg</span></span>:<br/><a href="2-pp.html#SP8_1">&#167;8.1</a>, <a href="2-pp.html#SP8_2">&#167;8.2</a>, <a href="2-pp.html#SP8_3">&#167;8.3</a>, <a href="2-pp.html#SP8_5">&#167;8.5</a>, <a href="2-pp.html#SP8_6">&#167;8.6</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">from</span><span class="plain-syntax">, </span><span class="identifier-syntax">dictionary</span><span class="plain-syntax"> *</span><span class="identifier-syntax">D</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_file_position</span><span class="plain-syntax"> *</span><span class="identifier-syntax">tfp</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">syntax</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">allow_unknown</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::get_first_char</span><span class="plain-syntax">(</span><span class="identifier-syntax">from</span><span class="plain-syntax">) == </span><span class="character-syntax">'*'</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">find</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Dictionaries::get_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="identifier-syntax">from</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">find</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">Str::duplicate</span><span class="plain-syntax">(</span><span class="identifier-syntax">find</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">allow_unknown</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><a href="2-pe.html#SP1" class="function-link"><span class="function-syntax">PipelineErrors::syntax_with</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">tfp</span><span class="plain-syntax">, </span><span class="identifier-syntax">syntax</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="string-syntax">"no such pipeline variable as '%S'"</span><span class="plain-syntax">, </span><span class="identifier-syntax">from</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">Str::duplicate</span><span class="plain-syntax">(</span><span class="identifier-syntax">from</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP10" class="paragraph-anchor"></a><b>&#167;10. Stages.</b>Stages are a fixed set within this compiler: there's no way for a pipeline
file to specify a new one.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">pipeline_stage</span><span class="plain-syntax"> *</span><span class="function-syntax">ParsingPipelines::parse_stage</span><button class="popup" onclick="togglePopup('usagePopup11')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup11">Usage of <span class="code-font"><span class="function-syntax">ParsingPipelines::parse_stage</span></span>:<br/><a href="2-pp.html#SP8">&#167;8</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">from</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">static</span><span class="plain-syntax"> </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">stages_made</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">stages_made</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">stages_made</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><a href="2-rmss.html#SP1" class="function-link"><span class="function-syntax">SimpleStages::create_pipeline_stages</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">CodeGen::create_pipeline_stage</span><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ns.html#SP1" class="function-link"><span class="function-syntax">NewStage::create_pipeline_stage</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="4-lbks.html#SP3" class="function-link"><span class="function-syntax">LoadBinaryKitsStage::create_pipeline_stage</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="3-css.html#SP1" class="function-link"><span class="function-syntax">CompileSplatsStage::create_pipeline_stage</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="4-dics.html#SP1" class="function-link"><span class="function-syntax">DetectIndirectCallsStage::create_pipeline_stage</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="6-erms.html#SP1" class="function-link"><span class="function-syntax">EliminateRedundantMatterStage::create_pipeline_stage</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="4-sws.html#SP1" class="function-link"><span class="function-syntax">ShortenWiringStage::create_pipeline_stage</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="6-erls.html#SP1" class="function-link"><span class="function-syntax">EliminateRedundantLabelsStage::create_pipeline_stage</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="6-eros.html#SP1" class="function-link"><span class="function-syntax">EliminateRedundantOperationsStage::create_pipeline_stage</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="5-msms.html#SP1" class="function-link"><span class="function-syntax">MakeSynopticModuleStage::create_pipeline_stage</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="3-ps.html#SP1" class="function-link"><span class="function-syntax">ParsingStages::create_pipeline_stage</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="3-rccs.html#SP1" class="function-link"><span class="function-syntax">ResolveConditionalsStage::create_pipeline_stage</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="4-rvs.html#SP1" class="function-link"><span class="function-syntax">ReconcileVerbsStage::create_pipeline_stage</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="4-mius.html#SP1" class="function-link"><span class="function-syntax">MakeIdentifiersUniqueStage::create_pipeline_stage</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">IndexStage::create_pipeline_stage</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">pipeline_stage</span><span class="plain-syntax"> *</span><span class="identifier-syntax">stage</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER</span><span class="plain-syntax">(</span><span class="identifier-syntax">stage</span><span class="plain-syntax">, </span><span class="reserved-syntax">pipeline_stage</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">from</span><span class="plain-syntax">, </span><span class="identifier-syntax">stage</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">stage_name</span><span class="plain-syntax">))</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">stage</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP11" class="paragraph-anchor"></a><b>&#167;11. Starting a variables dictionary.</b>Note that the above ways to create a pipeline all expect a dictionary of variable
names and their values to exist. These dictionaries are typically very small,
and by convention the main variable is <span class="extract"><span class="extract-syntax">*out</span></span>, the leafname to write output to.
So the following utility is convenient for getting started.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">dictionary</span><span class="plain-syntax"> *</span><span class="function-syntax">ParsingPipelines::basic_dictionary</span><span class="plain-syntax">(</span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">leafname</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">dictionary</span><span class="plain-syntax"> *</span><span class="identifier-syntax">D</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Dictionaries::new</span><span class="plain-syntax">(16, </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">leafname</span><span class="plain-syntax">) &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">Str::copy</span><span class="plain-syntax">(</span><span class="identifier-syntax">Dictionaries::create_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"*out"</span><span class="plain-syntax">), </span><span class="identifier-syntax">leafname</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Str::copy</span><span class="plain-syntax">(</span><span class="identifier-syntax">Dictionaries::create_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"*log"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"*log"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">D</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP12" class="paragraph-anchor"></a><b>&#167;12. Back to text.</b>Here we write a textual description to a string, which is useful for logging:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">ParsingPipelines::write_step</span><button class="popup" onclick="togglePopup('usagePopup12')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup12">Usage of <span class="code-font"><span class="function-syntax">ParsingPipelines::write_step</span></span>:<br/>Running Pipelines - <a href="2-rp.html#SP3_1">&#167;3.1</a><br/>Pipeline Errors - <a href="2-pe.html#SP2_2">&#167;2.2</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">pipeline_step</span><span class="plain-syntax"> *</span><span class="identifier-syntax">step</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"%S"</span><span class="plain-syntax">, </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_stage</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">stage_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_stage</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">stage_arg</span><span class="plain-syntax"> != </span><span class="constant-syntax">NO_STAGE_ARG</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">tree_argument</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">" %d"</span><span class="plain-syntax">, </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">tree_argument</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">package_URL_argument</span><span class="plain-syntax">) &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">":%S"</span><span class="plain-syntax">, </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">package_URL_argument</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">package_URL_argument</span><span class="plain-syntax">) &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">" %S"</span><span class="plain-syntax">, </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">package_URL_argument</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_stage</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">takes_tree</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">" &lt;- %S"</span><span class="plain-syntax">, </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_argument</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">generator_argument</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">" %S -&gt; %S"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">generator_argument</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">generator_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_argument</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="1-pm.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-pm.html">1</a></li><li class="progresscurrentchapter">2</li><li class="progresscurrent">pp</li><li class="progresssection"><a href="2-rp.html">rp</a></li><li class="progresssection"><a href="2-pe.html">pe</a></li><li class="progresssection"><a href="2-ns.html">ns</a></li><li class="progresssection"><a href="2-rmss.html">rmss</a></li><li class="progresschapter"><a href="3-ps.html">3</a></li><li class="progresschapter"><a href="4-lbks.html">4</a></li><li class="progresschapter"><a href="5-msms.html">5</a></li><li class="progresschapter"><a href="6-erms.html">6</a></li><li class="progressnext"><a href="2-rp.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

